home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
penguin_dinner.swf
/
scripts
/
__Packages
/
classes
/
game
/
Table.as
< prev
Wrap
Text File
|
2008-03-17
|
2KB
|
91 lines
class classes.game.Table extends classes.ui.IconicButton
{
var guests = [];
var earnings = 0;
function Table()
{
super();
this.stools.gotoAndStop("stool_" + String(classes.core.SOManager.getInstance().__get__upgradeStool()));
this.plate_0._visible = false;
this.plate_1._visible = false;
this.money._visible = false;
this.plate_0.stop();
this.plate_1.stop();
this.money.stop();
}
function onRelease()
{
}
function onPress()
{
if(this.locked)
{
return undefined;
}
classes.core.SoundManager.getInstance().startSound("click_game_object");
this.filters = [];
this.dispatchEvent(new classes.events.WidgetEvent(this,classes.ui.IconicButton.CLICK));
}
function showFood($guest)
{
var _loc2_ = 0;
while(_loc2_ < this.guests.length)
{
if(this.guests[_loc2_] == $guest)
{
this["plate_" + _loc2_]._visible = true;
this["plate_" + _loc2_].gotoAndStop($guest.food);
}
_loc2_ = _loc2_ + 1;
}
}
function setGuests($guests)
{
if($guests == undefined)
{
this.guests = [];
}
else
{
this.earnings = 0;
this.guests = $guests.slice();
}
this.guestsEating = this.guests.length;
}
function guestFinishedEating($guest, $guestWorstMood)
{
var _loc2_ = 0;
while(_loc2_ < this.guests.length)
{
if(this.guests[_loc2_] == $guest)
{
this["plate_" + _loc2_].gotoAndStop(classes.game.Food.TYPE_NONE);
}
_loc2_ = _loc2_ + 1;
}
this.earnings += classes.game.GameData.FOOD_PRICE($guestWorstMood);
this.showMoney($guestWorstMood);
}
function takeMoney()
{
this.money._visible = false;
this.plate_0._visible = false;
this.plate_1._visible = false;
this.attachMovie("cash_anim","cash_anim",1,{moneyStr:"$" + String(this.earnings),_x:0,_y:-20});
this.earnings = 0;
}
function showMoney($guestWorstMood)
{
this.guestsEating = this.guestsEating - 1;
if(this.guestsEating == 0 && this.earnings > 0)
{
this.money.gotoAndStop($guestWorstMood);
this.money._visible = true;
}
}
function isFree()
{
return this.guests.length == 0 && this.earnings == 0;
}
}